import { Component, Input, OnInit } from '@angular/core';
import { Router } from '@angular/router';

import { Principal, LoginService } from 'app/core';


@Component({
  selector: 'app-header',
  templateUrl: './app-header.component.html'
})
export class AppHeaderComponent {
  @Input() showAside = true;

  constructor(private principal: Principal, private loginService: LoginService, private router: Router) {

  }

  isAuthenticated() {
    return this.principal.isAuthenticated();
  }
  getImageUrl() {
      return this.isAuthenticated() ? this.principal.getImageUrl() : null;
  }
  logout() {
      this.loginService.logout();
      this.router.navigate(['/common/login']);
  }
}
